<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>帮帮网</title>
<link href="default.css" media="screen" rel="stylesheet" />
<!-- 引入 jQuery --> 
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>  -->
<script src="JS/jquery-1.3.2.min.js" type="text/javascript"></script>
<!--<script type="text/javascript" src="JS/prototype.js"></script>-->
<script type="text/javascript" src="JS/httpRequest.js"></script>
<script type="text/javascript" src="JS/cookie.js"></script>
<script type="text/javascript">  
//等待dom元素加载完毕.  
$(document).ready(function(){ 
	
	$("#left_bar ul li").click(function(){
		if($(this).hasClass("selector_on"))
		{
			
		}
		else
		{
			var sel_on = $("#left_bar .selector_on");
			sel_on.addClass("selector_off");
			sel_on.removeClass("selector_on");
			$(this).addClass("selector_on");
			$(this).removeClass("selector_off");
			//todo 刷新任务推送内容
		}
	});
/*
	$("#left_bar ul li").hover(
		function(){
			$(this).addClass("selector_on");
			$(this).removeClass("selector_off");
			//todo 抽出关注度最高的十个人 悬浮于右侧
		},
		function(){
			$(this).addClass("selector_off");
			$(this).removeClass("selector_on");
			//todo 取消显示右侧的人名
		}
	);
*/
});  


function showAllReqList()
{
	username=getCookie('username');
	userID = getCookie('userID');

	var allreqListDiv=document.getElementById('helps');
		//刷新前 先清空子节点
		var childs = allreqListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			allreqListDiv.removeChild(childs[i]);
		}


		var url="help/help.php?action=allReqList";
		var para=null;
		var resp=SendPostRequest(url,para);

		if(resp!=null || resp != 'false')
		{

			eval("allreqList="+resp);

			for(var i=0;i<allreqList.length;i++)
			{
				//
				var admincheck;
				if(username!=allreqList[i].requesterName)
					admincheck = false;
				else
					admincheck = true;
				

				var reqDiv=document.createElement("div");
				reqDiv.setAttribute("class","help");	
			
				//title 标题
				var titleDiv=document.createElement('div');
				titleDiv.style.padding="10px";
				titleDiv.innerHTML="<font style='14px bold'><a href='help/help.htm?"+allreqList[i].id+"' target='_blank'>"+allreqList[i].title+"</a></font>";
				reqDiv.appendChild(titleDiv);

				//money 赏金
				var moneyDiv=document.createElement('div');
				moneyDiv.style.padding="10px";
				moneyDiv.innerHTML="<font style='14px bold'>目标赏金："+allreqList[i].money+"</font>";
				reqDiv.appendChild(moneyDiv);

				//发布人
				var requesterDiv=document.createElement('div');
				requesterDiv.style.padding="10px";
				if(admincheck==true)//链接到主页
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].userID+"'/>"+allreqList[i].requesterName+"</a></font>";
				else				//链接到其他人的个人页面
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='hisSpace.htm?"+allreqList[i].userID+"'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].userID+"'/>"+allreqList[i].requesterName+"</a></font>";			
				reqDiv.appendChild(requesterDiv);
				//承接人
				var chooseDiv=document.createElement('div');
				chooseDiv.style.padding="10px";
				if(allreqList[i].chooseID==0)
					chooseDiv.innerHTML="<font style='14px bold'>暂时无人承接 <a href='help/help.htm?"+allreqList[i].id+"' target='_blank'> 请申请 </font><img width=50 height=50 src='imgpick/uploads/logo.jpg'/> </a>";
				else if(userID==allreqList[i].chooseID)//链接到主页
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].chooseID+"'/>"+allreqList[i].chooseName+"</a></font>";
				else				//链接到其他人的个人页面
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='hisSpace.htm?"+allreqList[i].chooseID+"'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].chooseID+"'/>"+allreqList[i].chooseName+"</a></font>";			
				reqDiv.appendChild(chooseDiv);
				//分类
				var  cateDiv=document.createElement('div');
				cateDiv.style.padding="10px";
				cateDiv.innerHTML="<font style='14px bold'>类别：		"+allreqList[i].cate+"</font>";				
				reqDiv.appendChild(cateDiv);
				//简介
				var  descriptionDiv=document.createElement('div');
				descriptionDiv.style.padding="10px";
				descriptionDiv.innerHTML="<font style='14px bold'>简介：        "+allreqList[i].description+"</font>";				
				reqDiv.appendChild(descriptionDiv);
				//状态
				var  statusDiv=document.createElement('div');
				statusDiv.style.padding="10px";
				statusDiv.innerHTML="<font style='14px bold'>状态：       "+allreqList[i].statusstr+"</font>";				
				reqDiv.appendChild(statusDiv);
				//详情
				var  detailDiv=document.createElement('div');
				detailDiv.style.padding="10px";
				detailDiv.innerHTML="<font style='14px bold'>详情：       "+allreqList[i].detail+"</font>";				
				reqDiv.appendChild(detailDiv);
				//对发布人评分
				var  ScoreReqDiv=document.createElement('div');
				ScoreReqDiv.style.padding="10px";
				if(allreqList[i].flagScoreReq!=0)	
					ScoreReqDiv.innerHTML="<font style='14px bold'>发布人得分：       "+allreqList[i].ScoreReq+"</font>";				
				else
					ScoreReqDiv.innerHTML="<font style='14px bold'>承接人还没有对发布人打分</font>";				
				reqDiv.appendChild(ScoreReqDiv);
				//对承接人评分
				var  ScoreChooseDiv=document.createElement('div');
				ScoreChooseDiv.style.padding="10px";
				if(allreqList[i].flagScoreChoose!=0)	
					ScoreChooseDiv.innerHTML="<font style='14px bold'>承接人得分：       "+allreqList[i].ScoreChoose+"</font>";				
				else
					ScoreChooseDiv.innerHTML="<font style='14px bold'>发布人还没有对承接人打分</font>";				
				reqDiv.appendChild(ScoreChooseDiv);

				allreqListDiv.appendChild(reqDiv);				
			}	
		}
}

function showHelpsCate(cateid)
{
	var allreqListDiv=document.getElementById('helps');
		//刷新前 先清空子节点
		var childs = allreqListDiv.childNodes;
		for(var i=childs.length-1; i>=0; i--){
			allreqListDiv.removeChild(childs[i]);
		}


		var url="help/help.php?action=cateReqList";
		var para="&cate="+cateid;
		var resp=SendPostRequest(url,para);
		
		//alert(resp);
	
		if(resp!=null || resp != 'false')
		{

			eval("allreqList="+resp);

			for(var i=0;i<allreqList.length;i++)
			{
				//
				var admincheck;
				if(username!=allreqList[i].requesterName)
					admincheck = false;
				else
					admincheck = true;
				

				var reqDiv=document.createElement("div");
				reqDiv.setAttribute("class","help");	
			
				//title 标题
				var titleDiv=document.createElement('div');
				titleDiv.style.padding="10px";
				titleDiv.innerHTML="<font style='14px bold'><a href='help/help.htm?"+allreqList[i].id+"' target='_blank'>"+allreqList[i].title+"</a></font>";
				reqDiv.appendChild(titleDiv);

				//money 赏金
				var moneyDiv=document.createElement('div');
				moneyDiv.style.padding="10px";
				moneyDiv.innerHTML="<font style='14px bold'>目标赏金："+allreqList[i].money+"</font>";
				reqDiv.appendChild(moneyDiv);

				//发布人
				var requesterDiv=document.createElement('div');
				requesterDiv.style.padding="10px";
				if(admincheck==true)//链接到主页
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].userID+"'/>"+allreqList[i].requesterName+"</a></font>";
				else				//链接到其他人的个人页面
					requesterDiv.innerHTML="<font style='14px bold'>发布者 <a href='hisSpace.htm?"+allreqList[i].userID+"'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].userID+"'/>"+allreqList[i].requesterName+"</a></font>";			
				reqDiv.appendChild(requesterDiv);
				//承接人
				var chooseDiv=document.createElement('div');
				chooseDiv.style.padding="10px";
				if(allreqList[i].chooseID==0)
					chooseDiv.innerHTML="<font style='14px bold'>暂时无人承接 <a href='help/help.htm?"+allreqList[i].id+"' target='_blank'> 请申请 </font><img width=50 height=50 src='imgpick/uploads/logo.jpg'/> </a>";
				else if(userID==allreqList[i].chooseID)//链接到主页
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='#'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].chooseID+"'/>"+allreqList[i].chooseName+"</a></font>";
				else				//链接到其他人的个人页面
					chooseDiv.innerHTML="<font style='14px bold'>承接者 <a href='hisSpace.htm?"+allreqList[i].chooseID+"'><img width=50 height=50 src='imgpick/uploads/"+allreqList[i].chooseID+"'/>"+allreqList[i].chooseName+"</a></font>";			
				reqDiv.appendChild(chooseDiv);
				//分类
				var  cateDiv=document.createElement('div');
				cateDiv.style.padding="10px";
				cateDiv.innerHTML="<font style='14px bold'>类别：		"+allreqList[i].cate+"</font>";				
				reqDiv.appendChild(cateDiv);
				//简介
				var  descriptionDiv=document.createElement('div');
				descriptionDiv.style.padding="10px";
				descriptionDiv.innerHTML="<font style='14px bold'>简介：        "+allreqList[i].description+"</font>";				
				reqDiv.appendChild(descriptionDiv);
				//状态
				var  statusDiv=document.createElement('div');
				statusDiv.style.padding="10px";
				statusDiv.innerHTML="<font style='14px bold'>状态：       "+allreqList[i].statusstr+"</font>";				
				reqDiv.appendChild(statusDiv);
				//详情
				var  detailDiv=document.createElement('div');
				detailDiv.style.padding="10px";
				detailDiv.innerHTML="<font style='14px bold'>详情：       "+allreqList[i].detail+"</font>";				
				reqDiv.appendChild(detailDiv);
				//对发布人评分
				var  ScoreReqDiv=document.createElement('div');
				ScoreReqDiv.style.padding="10px";
				if(allreqList[i].flagScoreReq!=0)	
					ScoreReqDiv.innerHTML="<font style='14px bold'>发布人得分：       "+allreqList[i].ScoreReq+"</font>";				
				else
					ScoreReqDiv.innerHTML="<font style='14px bold'>承接人还没有对发布人打分</font>";				
				reqDiv.appendChild(ScoreReqDiv);
				//对承接人评分
				var  ScoreChooseDiv=document.createElement('div');
				ScoreChooseDiv.style.padding="10px";
				if(allreqList[i].flagScoreChoose!=0)	
					ScoreChooseDiv.innerHTML="<font style='14px bold'>承接人得分：       "+allreqList[i].ScoreChoose+"</font>";				
				else
					ScoreChooseDiv.innerHTML="<font style='14px bold'>发布人还没有对承接人打分</font>";				
				reqDiv.appendChild(ScoreChooseDiv);

				allreqListDiv.appendChild(reqDiv);				
			}	
		}
}

function focusCate(cateid)
{
	//alert(userID);
	if(!userID)
	{
		alert("请登录");
		return;
	}
	var url="user/user.php?action=focusCate";
	var para="userID="+userID;
	para+="&cate="+cateid;
	var resp=SendPostRequest(url,para);	
	//alert(resp);
	if(resp=="您已经关注了本分类")
	{
		alert(resp);
	}
	else if (resp=="false")
	{
		alert("关注此分类失败 请和官方联系");
	}
	else if (resp=="true")
	{
		alert("成功关注此分类");
	}
}

function unfocusCate(cateid)
{
	//alert(userID);
	if(!userID)
	{
		alert("请登录");
		return;
	}
	var url="user/user.php?action=unfocusCate";
	var para="userID="+userID;
	para+="&cate="+cateid;
	var resp=SendPostRequest(url,para);	
	//alert(resp);
	if(resp=="您还没有关注本分类")
	{
		alert(resp);
	}
	else if (resp=="false")
	{
		alert("解除关注此分类失败 请和官方联系");
	}
	else if (resp=="true")
	{
		alert("成功解除对分类的关注");
	}
}

</script>  
</head>
<body onload="showAllReqList()">
  <div id="all">
    <div id="header">
        <div id="inner_header" class="central_fixed_width">
			<img src='imgpick/uploads/logo.jpg'/> 
		    <h1 class="logo">帮帮网</h1>
            <div id="user_status"><a href="login.htm">登陆</a>||<a href="register.html">注册</a></div>
            <ul id="nav_bar">
                <li><a href="activity/activity.html"><span class="nav_item">活动</span></a></li>
                <li><a href="index.html"><span class="nav_item">悬赏求助大厅</span></a></li>
                <li><a href="myspace.html"><span class="nav_item">个人主页</span></a></li>
                <li><a href="dianping.html"><span class="nav_item">点评</span></a></li>
                <li><a href="novel.html"><span class="nav_item">小说</span></a></li>
                <li class="clear"></li>
            </ul>
        </div>
    </div>
    
    <div id="content" class="central_fixed_width">

        <div class="content_parent">
			<div id="left_bar">
                    <ul>
                        <li class="selector_off" onclick="showHelpsCate(1)">生活</li>
							<span><button type="button" onclick="unfocusCate(1)">解除关注</button></span>
							<span><button type="button" onclick="focusCate(1)">关注该分类</button></span>

                        <li class="selector_off" onclick="showHelpsCate(2)">软件</li>
							<span><button type="button" onclick="unfocusCate(2)">解除关注</button></span>
							<span><button type="button" onclick="focusCate(2)">关注该分类</button></span>

                        <li class="selector_off" onclick="showHelpsCate(3)">电脑</li>
							<span><button type="button" onclick="unfocusCate(3)">解除关注</button></span>
							<span><button type="button" onclick="focusCate(3)">关注该分类</button></span>

                        <li class="selector_off" onclick="showHelpsCate(4)">足球</li>
							<span><button type="button" onclick="unfocusCate(4)">解除关注</button></span>
							<span><button type="button" onclick="focusCate(4)">关注该分类</button></span>

						<li class="selector_off" onclick="showHelpsCate(5)">二手买卖</li>
							<span><button type="button" onclick="unfocusCate(5)">解除关注</button></span>
							<span><button type="button" onclick="focusCate(5)">关注该分类</button></span>

                        <li class="selector_off" onclick="showHelpsCate(0)">未定义</li>
							<span><button type="button" onclick="unfocusCate(0)">解除关注</button></span>
							<span><button type="button" onclick="focusCate(0)">关注该分类</button></span>

                    </ul>
			</div>

            <div class="main_column2">

                <div id="helps">
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
					
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                    <div class="help">
                        <div class="content"><span class="activity_owner">老赵</span> 发布了任务<a href="#">做个页面</a></div>
                        <div class="activity_timestamp">30 分钟前</div>
                    </div>
                </div>

            </div>

            <div class="clear"></div>
        </div>
        
        
    </div>
    
    <div id="footer">
        <div id="inner_footer" class="central_fixed_width">


            <div class="footer_links">
                &copy; 2011 帮帮网 All rights reserved.
            </div>
            <div class="clear"></div>
            
        </div>
    </div>
  </div>
</body>
</html>

